<!doctype html>
<html class="no-js">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{$siteInfo['title']}-{$siteInfo['subtitle']}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="/themes/amaze/assets/css/amazeui.min.css">
  </head>
  <body>
     {include file="public/nav" /} 
    <!--轮播图-->
    <div data-am-widget="slider" class="am-slider am-slider-c1" data-am-slider='{"directionNav":false}' >
      <ul class="am-slides">
         {volist name="carousel" id="vo"}
        <li>
          <a href="{:url('/'.$vo.article_id)}"><img style="height:200px;" src="{$vo.img|default='/themes/blog/static/images/default/default.jpg'}"></a>
          <div class="am-slider-desc">{$vo.title}</div>
        </li>
         {/volist}
      </ul>
    </div>

    <!--置顶推荐-->
    <div data-am-widget="titlebar" class="am-titlebar am-titlebar-multi" >
      <h2 class="am-titlebar-title ">置顶推荐</h2>
    </div>
    <ul data-am-widget="gallery" class="am-gallery am-avg-sm-2  am-avg-md-3 am-avg-lg-4 am-gallery-overlay" data-am-gallery="{ pureview: true }" >
       {volist name="topArticle" id="vo"}
      <li>
        <div class="am-gallery-item">
          <a href="{:url('/' .$vo.article_id)}" >
            <img style="height:100px" src="{$vo.img|default='/themes/blog/static/images/default/default.jpg'}"  alt="{$vo.title}"/>
            <h3 class="am-gallery-title">{$vo.title}</h3>
          </a>
        </div>
      </li>
      {/volist}
    </ul>

    <!--内容列表-->
    <div data-am-widget="titlebar" class="am-titlebar am-titlebar-multi" >
      <h2 class="am-titlebar-title ">最新文章</h2>
    </div>
    <div data-am-widget="list_news" class="am-list-news am-list-news-default" >
      <div class="am-list-news-bd">
        <ul class="am-list" id="new-list"></ul>
      </div>
    </div>
    <button id="load-new" type="button" class="am-btn am-btn-secondary am-btn-block">加载更多</button>
    {include file="public/footer" /}     
    <script src="/themes/amaze/assets/js/amazeui.min.js"></script>
    <script src="/themes/amaze/assets/js/common.js"></script>
      <script>
      var page = 1;
      loadNews(page);
      $("#load-new").click(function () {
        page = page +1;
        loadNews(page)
      })
      function loadNews(page) {
        $.ajax({
          type: "POST",
          url: "/home/index/newList",
          data: {
            page: page
          },
          success: function (newList) {
            if (newList == ""){
              $("#load-new").text("没有更多了")
              $("#load-new").css({"background":"#999","border":"0px"})
              $("load-new").addClass("am-disabled");
            }
            $.each(newList, function (index, item) {
              
              var createTime = getMyDate(item.create_time);
              if (item.img == "") {
                item.img = '/themes/blog/static/images/default/default.jpg';
              }
              $("#new-list").append('<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left"><div class="am-u-sm-4 am-list-thumb"><a href="/'+item.article_id+'"><img style="height:80px;" src="'+item.img+'" /></a></div><div class=" am-u-sm-8 am-list-main"><h3 class="am-list-item-hd"><a href="'+item.article_id+'">'+item.title+'</a></h3><div class="am-list-item-text">'+item.introduce.substr(0, 35)+'</div></div></li>');
             /*$("#new-list").append('  <div class="list-content">' +
                      '          <div class="list-img"><img src="' + item.img + '"/></div>\n' +
                      '          <div class="list-right">' +
                      '            <a  href="' + '/' + item.article_id + '.html" target="_blank">' + item.title + '</a>' +
                      '            <p style="color: #C0C0C0;margin: 5px;">' +
                      '              <i class="layui-icon" style="font-size: 15px;">&#xe638;</i>' + item.category_name +
                      '              <i class="layui-icon" style="font-size: 15px;">&#xe612;</i>' + item.username +
                      '              浏览：' + item.read_count +
                      '              <i class="layui-icon" style="font-size: 15px;">&#xe60e;</i>' + createTime +
                      '            </p>' +
                      '            <p style="color: rgba(0,0,0,.6);font-size: 1rem;margin-top: 20px">' + item.introduce.substr(0, 70) + '</p>' +
                      '          </div>' +
                      '        </div>' +
                      '        <hr />')*/
            })
          }
        })
      }
    </script>
  </body>
</html>
